package com.pillar;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * @author pillar
 * @desc
 * @email: 347637454@qq.com
 * @createDate
 */
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {

    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo()).groupName("游戏控制中心")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.pillar.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("游戏控制中心")
                .description("游戏控制中心,拥有游戏高级控制权限")
                .termsOfServiceUrl("https://game.com")
                .contact(new Contact("pillar", "", "347637454@qq.com"))
                .version("1.0")
                .build();
    }
}
